<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
$_dailyDealsCollection = $this->loadDailyDealsCollection();
$_firstDeals = $_dailyDealsCollection->getFirstItem();
$_helper = $this->helper('catalog/output');
?>

<?php $buttonTitle = $this->__('Add to Cart'); ?>
<?php if (!$_dailyDealsCollection->count()): ?>
    <p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else: ?>
        <div class="page-title category-title">
            <h1><?php echo $this->getSettings()->getPageTitle(); ?></h1>
        </div>
        <div class="category-products">
          <?php foreach ($_dailyDealsCollection as $deal):
                $_product = Mage::getModel('catalog/product')->load($deal->getProduct_id());
         ?>
              <div class="product-shop">
                <div class="product-name">
                    <h1><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h1>
                </div>

                  <div class="price-box" id="product_price">
                      <?php echo $this->getPriceHtml($_product, true) ?>
                </div>
           <?php if ($_product->getShortDescription()):?>
                    <div class="short-description">
                        <div class="std"><?php echo $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description') ?></div>
                    </div>
           <?php endif;?>


            <?php if ($_product->getImage() != 'no_selection' && $_product->getImage()): ?>
            <p class="product-image product-image-zoom">
                <?php
                    $_img = '<img id="image" src="'.$this->helper('catalog/image')->init($_product, 'image').'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />';
                    echo $_helper->productAttribute($_product, $_img, 'image');
                ?>
            </p>
            <p class="zoom-notice" id="track_hint"><?php echo $this->__('Double click on above image to view full picture') ?></p>
            <div class="zoom">
                <img id="zoom_out" src="<?php echo $this->getSkinUrl('images/slider_btn_zoom_out.gif') ?>" alt="<?php echo $this->__('Zoom Out') ?>" title="<?php echo $this->__('Zoom Out') ?>" class="btn-zoom-out" />
                <div id="track">
                    <div id="handle"></div>
                </div>
                <img id="zoom_in" src="<?php echo $this->getSkinUrl('images/slider_btn_zoom_in.gif') ?>" alt="<?php echo $this->__('Zoom In') ?>" title="<?php echo $this->__('Zoom In') ?>" class="btn-zoom-in" />
            </div>
            <script type="text/javascript">
            //<![CDATA[
                Event.observe(window, 'load', function() {
                    product_zoom = new Product.Zoom('image', 'track', 'handle', 'zoom_in', 'zoom_out', 'track_hint');
                });
            //]]>
            </script>
            <?php else: ?>
            <p class="product-image">
                <?php
                    $_img = '<img src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(265).'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />';
                    echo $_helper->productAttribute($_product, $_img, 'image');
                ?>
            </p>
            <?php endif; ?>
            <?php if (count($_product->getMediaGalleryImages()) > 0): ?>
            <div class="more-views">
                <h2><?php echo $this->__('More Views') ?></h2>
                <ul>
                <?php foreach ($_product->getMediaGalleryImages() as $_image): ?>
                    <li>
                        <a href="#" onclick="popWin('<?php echo $this->getGalleryUrl($_product, $_image) ?>', 'gallery', 'width=300,height=300,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes'); return false;" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail', $_image->getFile())->resize(56); ?>" width="56" height="56" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" /></a>
                    </li>
                <?php endforeach; ?>
                </ul>
            </div>
            <?php endif; ?>


            <?php if($_product->isSaleable()): ?>
                         <button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getUrl('checkout/cart/add', array('product' => $_product->getId())) ?>')"><span><span><?php echo $buttonTitle ?></span></span></button>
             <?php endif; ?>
            </div>
            <?php endforeach; ?>
        </div>
<?php endif; ?> 